using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Web
{
	public partial class portal : Lutos.Control.PageUtilities
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			string portalName = Request.Params["rn"];
			if (portalName == null)
			{
				Response.Write("Please input the entry portal name!");
				
				Response.End();
				return;
			}

			Lutos.Portal.PortalMapper portalMapper = new Lutos.Portal.PortalMapper();
			Lutos.Portal.Portal portal = portalMapper.GetPortalByName(portalName);
			if(portal == null)
			{
				Response.Write("There is no portal with the name of " + portalName);
				Response.End();
				return;
			}
			slogoImg.ImageUrl = portal.LogoUrl;
			bannerImg.ImageUrl = portal.BannerUrl;
			HyperLink1.NavigateUrl = portal.BannerNevUrl;
			this.RegionBlockControl1.Initialize(this.AppRegionTree, this.AppItemAdapter, portal.LeftRegionID, 20);
			this.RegionBlockControl2.Initialize(this.AppRegionTree, this.AppItemAdapter, portal.RightRegionID, 20);
			this.CategoryBlockControl1.Initialize(this.AppCategoryTree, this.AppItemAdapter, portal.LeftCategoryID, 20);
			this.CategoryBlockControl2.Initialize(this.AppCategoryTree, this.AppItemAdapter, portal.RightCategoryID, 20);
			this.ItemListControl1.Initialize(this.AppItemAdapter.GetItems(portal.InfoBoxCID, portal.InfoBoxRID, 0, 10), portal.InfoBoxCID, portal.InfoBoxRID, 20, 0, 1, this.AppItemAdapter);
		}
	}
}
